<script setup lang="ts">
import locale from 'element-plus/dist/locale/zh-cn.mjs'

import UpdateDialog from './components/application/src/UpdateDialog.vue'
import { useCreateMessageBox } from './hooks/useMessageBox'
import { useSignInCheck } from './hooks/useSignInCheck'
import { useAppStore } from './stores/modules/app'

useSignInCheck()
useCreateMessageBox()

const appStore = useAppStore()
const visible = ref<boolean>(false)

onMounted(() => {
  document.body.addEventListener('plugin_web_update_notice', () => {
    visible.value = true
  })
  appStore.getWebsiteConfig()
})
</script>

<template>
  <el-config-provider :locale="locale">
    <router-view />
    <UpdateDialog v-model:visible="visible" />
    <basic-message-box />
  </el-config-provider>
</template>

<style scoped></style>
